using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Elementum
{
    public class ModifierContain
    {
        List<Modifier> _modifierList;
        VisibleObject _target;

        public ModifierContain(VisibleObject target) {
            _modifierList = new List<Modifier>();
            _target = target;
        }

        public int Conuter {
            set
            {
                foreach (Modifier m in _modifierList)
                    m._counter = value;
                foreach (Modifier m in _modifierList)
                    m._isModifyDone = false;
            }
        }

        public void AddModifier(Modifier modifier) {
            if (!_modifierList.Contains(modifier))
            {
                modifier.Register(_target);
                _modifierList.Add(modifier);
            }
        }

        public void RemoveModifier(Modifier modifier)
        {
            modifier.UnRegister();
            _modifierList.Remove(modifier);
        }

        public bool IsAllModifierDone() {
            bool temp = true;
            foreach (Modifier m in _modifierList)
                temp = temp && m._isModifyDone;
            return temp;
        }

        public void Update() {
            foreach (Modifier m in _modifierList)
                m.Update();
        }

    }
}
